package com.oto.util;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.jersey.spi.spring.container.servlet.SpringServlet;

/**
 * @author xueqiang.mi
 * @since 2011-1-4
 */
public class CustomJerseyFilter extends SpringServlet {
	private static final long serialVersionUID = 1445292240604637025L;

	@Override
	public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException,
			ServletException {
		String requestURI = request.getRequestURI();
		if (!requestURI.contains("/_ah/")) {
			super.doFilter(request, response, chain);
		} else {
			response.setCharacterEncoding("UTF-8");
			chain.doFilter(request, response);
		}
	}
}
